package edu.scau.pos.domain;

import edu.scau.pos.vo.SaleItemVo;
import edu.scau.pos.vo.SaleLineItemVo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@Data
public class SaleLineItem implements Serializable {
    private static final long serialVersionUID = 1L;
    private Long saleItemId;
    private String productName;
    private String productSn;
    private Product product;
    private int quantity;
    private String orderId;
    //对应商品总价
    private double amount;
    private int status;
    private int isDeleted;//逻辑删除
    @Schema(name = "createBy", type = "String")
    private String createBy;

    @Schema(name = "createTime", type = "Date")
    private Date createTime;

    @Schema(name = "updateBy", type = "String")
    private String updateBy;

    @Schema(name = "updateTime", type = "Date")
    private Date updateTime;


    public SaleLineItem(Long saleItemId, String productName, String productSn, Product product, int quantity, String orderId, double amount, int status, int isDeleted, String createBy, Date createTime, String updateBy, Date updateTime) {
        this.saleItemId = saleItemId;
        this.productName = productName;
        this.productSn = productSn;
        this.product = product;
        this.quantity = quantity;
        this.orderId = orderId;
        this.amount = amount;
        this.status = status;
        this.isDeleted = isDeleted;
        this.createBy = createBy;
        this.createTime = createTime;
        this.updateBy = updateBy;
        this.updateTime = updateTime;
    }

    public SaleLineItem() {
    }

    public SaleLineItem(SaleItemVo saleLineItem) {
        this.saleItemId = saleLineItem.getSaleItemId();
        this.productName = saleLineItem.getProductName();
        this.productSn = saleLineItem.getProductSn();
        this.quantity = saleLineItem.getQuantity();
        this.amount = saleLineItem.getAmount();
        this.status = saleLineItem.getStatus();
    }
}
